<script setup>
import router from "@/router/index.js";

const navigateToGoods = (item) => {
  router.push({
    path: '/collect',
    query: {
      name:item.name,
      price: item.price,
      description: item.description,
      image: encodeURIComponent(item.image),
      stock:item.stock,
      id:item.id,
    }
  });
};
</script>

<template>
<div class="top-nav">
  <div class="w">
    <ul>
      <li><a href="javascript:;">个人中心</a></li>
      <li><a href="javascript:;">我的订单</a></li>
      <li><a href="javascript:;" @click="navigateToGoods">我的收藏</a></li>
      <li><a href="javascript:;">登录/注册</a></li>
    </ul>
  </div>
</div>
</template>

<style scoped>
.top-nav {
  background-color: #333;
  ul {
    display: flex;
    height: 40px;
    line-height: 40px;
    justify-content: flex-end;
    li {
      a {
        font-size: 12px;
        padding: 0 15px;
        color: #ccc;
        border-left: 1px solid #ccc;

        &:hover {
          color:#27ba9b;
        }
      }
    }
    li:nth-child(1) {
      a {
        border-left: 0;
      }
    }
  }
}
</style>